﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WinForm003
{
    
    public class dBHelper
    {
        private readonly static string conStr = "server=.;uid=sa;pwd=123456;database=Student";

        public static DataTable GetDataTable(string cmdStr)
        {
            SqlConnection connection = new SqlConnection(conStr);

            SqlDataAdapter sqlData = new SqlDataAdapter(cmdStr,connection);

            DataTable data = new DataTable();

            connection.Open();

            sqlData.Fill(data);

            return data;
        }

    }
}
